home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
003
/
db3tech.arc
/
CAPSTR.PRG
< prev
next >
Wrap
Text File
|
1985-11-01
|
994b
|
31 lines
* Program ...: Capstr.PRG
* Author ....: Christopher White
* Date ......: July 1, 1985
* Version ...: dBASE III, any version
* Note(s)....: Capitalizes the first words in a string except
* for those speicified in an exception string.
*
PRIVATE string, fstring, word, exception
PARAMETERS string
* ---Initialize.
string = LOWER( TRIM( string ) ) + SPACE( 2 )
exception = "a an and for in or the "
* ---Capitalize the first word.
word = UPPER( SUBSTR( string,1,1 ) ) + SUBSTR( string,2,AT( " ",string ) - 1 )
fstring = word
string = SUBSTR( string,LEN( word ) + 1 )
DO WHILE LEN( TRIM( string ) ) <> 0
* ---Capitalize the next word.
word = UPPER( SUBSTR( string,1,1 ) ) + SUBSTR( string,2,AT( " ",string ) - 1 )
* ---Test for exceptional words.
IF LOWER( word ) $ exception
word = LOWER( word )
ENDIF
fstring = fstring + word
string = SUBSTR( string,LEN( word ) + 1 )
ENDDO
string = TRIM( fstring )
RETURN
* EOP Capstr.PRG